//
// Created by zhupi on 2024/9/5.
//

#include "toolbar_widget.h"
#include <QVBoxLayout>

#include "gallery_desktop.h"
#include "gallery_view.h"

toolbar_widget::toolbar_widget() {}

void MainWindowToolBarWidget::InitIal()
{
    toolbarTabWidget_ = new QTabWidget(this);
    toolbarTabWidget_->setTabPosition(QTabWidget::South);
    this->setFixedHeight(150);

    InitLayout();
    InitDesktop();
    InitView();
    InitModel();
    InitHilp();
}

QWidget *MainWindowToolBarWidget::AddTabWidget(const QString& tabName)
{
    QWidget *widget = new QWidget(this);
    toolbarTabWidget_->addTab(widget, tabName);
}

void MainWindowToolBarWidget::InitLayout()
{
    QVBoxLayout *mainVbox = new QVBoxLayout(this);
    mainVbox->setContentsMargins(0, 0, 0, 0);
    mainVbox->addWidget(toolbarTabWidget_);
    this->setLayout(mainVbox);
}

void MainWindowToolBarWidget::InitDesktop()
{
    GalleryDesktop * widget = new GalleryDesktop(this);
    widget->Initial();
    toolbarTabWidget_->addTab(widget, "Desktop");
//    QWidget *widget = AddTabWidget("Desktop");
}

void MainWindowToolBarWidget::InitView() {
    GalleryView *widget = new GalleryView(this);
    widget->Initial();
    toolbarTabWidget_->addTab(widget, "View");
}

void MainWindowToolBarWidget::InitModel() {
    GalleryView *widget = new GalleryView(this);
    widget->Initial();
    toolbarTabWidget_->addTab(widget, "Model");
}

void MainWindowToolBarWidget::InitHilp() {
    GalleryView *widget = new GalleryView(this);
    widget->Initial();
    toolbarTabWidget_->addTab(widget, "help");
}
